﻿<%@ Page Language="C#" MasterPageFile="../../MasterPage.Master" AutoEventWireup="true" CodeBehind="ICM_Receive.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Form.ICM_Receive" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register TagPrefix="custom" Namespace="KPIS.Customs.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" src="../../Scripts/Common.js"></script>

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        
        <script type="text/javascript">            
            function onTextChangeGeneral(sender) 
            {
                if (sender.get_value() == "") {
                    sender.set_text("");
                }
            }
            function OpenReceiveItem(ReceiveSeq, DnSeq) {
                radopen('../Form/ICM_ReceiveItem.aspx?ReceiveSeq=' + ReceiveSeq + '&DnSeq=' + DnSeq, 'WindowDetail');
            }
            function closeRadWindow(sender, args) {
                $find("<%= RadManager1.ClientID %>").ajaxRequest('CloseWindow');
            }

            function SeqClick(seq) 
            {
                var hiddenElement = document.getElementById("<%= hdSeq.ClientID %>");
                hiddenElement.value = seq;
                $find("<%= RadManager1.ClientID %>").ajaxRequest(seq);
            }

            function ExpandPersonal(sender, Args){
                 if (!sender._loaded){
                    $find("<%=RadAjaxPanel1.ClientID %>").ajaxRequest();
                    sender._loaded = true;
                }
            }               

            function CloseTooltip() {
                var radToolTip = $find("<%= RadToolTip2.ClientID %>");
                radToolTip.hide();
            }
            function CheckWareHouse(cmbWareHouse, cmbJobSite) {
                var cmbWareHouse = document.getElementById(cmbWareHouse);
                var cmbJobSite = document.getElementById(cmbJobSite);

                cmbWareHouse.style.visibility = "visible";
                cmbJobSite.style.visibility = "hidden";
            }
            function CheckJobSite(cmbWareHouse, cmbJobSite) {
                var cmbWareHouse = document.getElementById(cmbWareHouse);
                var cmbJobSite = document.getElementById(cmbJobSite);

                cmbWareHouse.style.visibility = "hidden";
                cmbJobSite.style.visibility = "visible";
            }
            
            function VisibleWareHouse(Value, cbWarehouse, cbJobSite) {
                var Warehouse = document.getElementById(cbWarehouse);
                var cbJobSite = document.getElementById(cbJobSite);
                if (Value == "1") {
                    Warehouse.style.visibility = "visible";
                    cbJobSite.style.visibility = "hidden";
                }
                else {
                    Warehouse.style.visibility = "hidden";
                    cbJobSite.style.visibility = "visible";
                }
            } 

//            Sys.Application.add_load(setCalendarTable);
            
            function setCalendarTable() {
                var tooltip = $find("<%= ToolTipIcmReceiveDate.ClientID %>");
                var calendar = $find("<%= CalendarIcmReceiveDate.ClientID %>");
                var fastNavigation = calendar._getFastNavigation();
                fastNavigation.OnToday =
                        function() {
                            var today = new Date;
                            var date = [today.getFullYear(), today.getMonth() + 1, today.getDate()];
                            calendar.selectDate(date, true);
                            fastNavigation.Popup.Hide();
                            var all_date = date.toString().split(",");
                            var year = parseInt(all_date[0]) + 543;
                            var month = all_date[1];
                            var day = all_date[2];
                            if (day.length == 1) {
                                day = '0' + day;
                            }
                            if (month.length == 1) {
                                month = '0' + month;
                            }

                            var maskText = $find("<%= txtIcmReceiveDate.ClientID %>");
                            maskText.set_value(day + month + year);
                            tooltip.hide();
                        }
            }
            function OnReceiveDateClick(calendarInstance, args) {
                var tooltip = $find("<%= ToolTipIcmReceiveDate.ClientID %>");
                var fastNavigation = calendarInstance._getFastNavigation();
                var date = args.get_renderDay().get_date().toString();
                var all_date = date.split(",");
                var year = parseInt(all_date[0]) + 543;
                var month = all_date[1];
                var day = all_date[2];
                if (day.length == 1) {
                    day = '0' + day;
                }
                if (month.length == 1) {
                    month = '0' + month;
                }

                var maskText = $find("<%= txtIcmReceiveDate.ClientID %>");
                maskText.set_value(day + month + year);
                tooltip.hide();
            }
            function OnCalendarViewChanged(sender, step) {
                var year = parseInt(sender.FocusedDate[0]) + 543;
                var month = sender.FocusedDate[1];
                document.getElementById("CalendarIcmReceiveDate_Title").innerHTML = changeMonthNumberToName(month) + " " + year;
            }
        </script>
        
    </telerik:RadCodeBlock>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None" Skin="Outlook">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadWindowManager ID="RadWindowManager1" 
        ShowContentDuringLoad="false" VisibleStatusbar="false" ReloadOnShow="true" 
        runat="server" Skin="Vista" Modal="true" DestroyOnClose = "true"
        KeepInScreenBounds="true" Style="z-index: 7001">
        <Windows>
            <telerik:RadWindow ID="WindowDetail" runat="server" 
                Width="1000px" Height="550px" 
                skin = "Vista"
                Behaviors="Default" 
                OnClientClose="closeRadWindow">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager> 
    <telerik:RadAjaxManager runat="server" ID="RadManager1" OnAjaxRequest="RadManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="panelCommand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ShowGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Edit">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="EditSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="AddNewSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Cancel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Delete">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             <telerik:AjaxSetting AjaxControlID="panelData">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cbReceiveType">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelTransfer" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    
    <asp:Panel ID="panelHidden" runat="server">
        <asp:HiddenField ID="hdSeq" runat="server" Value="" />
    </asp:Panel>

    <telerik:RadSplitter id="RadSplitter1" runat="server" height="460" width="1000" Skin="Office2007">
        <telerik:RadPane id="LeftPane" runat="server" width="22" Scrolling="None" Locked="true">
            <telerik:RadSlidingZone id="SlidingZone1" runat="server" width="22" ClickToOpen="true">
                <telerik:RadSlidingPane id="PanePersonal" title="ข้อมูลส่วนตัว" runat="server" width="265" 
                    IconUrl="../Image/General/user.gif" EnableDock="false" 
                    OnClientBeforeExpand="ExpandPersonal">
                    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" OnAjaxRequest="OnAjaxRequest">
                    </telerik:RadAjaxPanel>
                </telerik:RadSlidingPane>
            </telerik:RadSlidingZone>
        </telerik:RadPane>
        <telerik:RadSplitBar id="RadSplitBar1" runat="server"></telerik:RadSplitBar>
        <telerik:RadPane id="PaneData" runat="server" Scrolling="None">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <asp:Panel ID="panelCommand" runat="server">
                            <div class="bigModulePaneFull">
                                <div class="bigModuleBottomPaneFull">
                                    <table cellpadding="0" cellspacing="0">
                                        <tr class="command-list">
                                            <td class="command-item" style="border: none">
                                                <asp:LinkButton ID="ShowGrid" runat="server" CssClass="LinkButton" onclick="ShowGrid_Click" CausesValidation="false">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/table.gif" />&nbsp;&nbsp;แสดงข้อมูลทั้งหมด
                                                </asp:LinkButton>                        
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="AddNew" runat="server" CssClass="LinkButton" CausesValidation="false" >
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/AddRecord.gif" />&nbsp;&nbsp;เพิ่มข้อมูลใหม่
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="Edit" runat="server" CssClass="LinkButton"  visible="false" OnClick="Edit_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Edit.gif" />&nbsp;&nbsp;แก้ไขข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="Delete" runat="server" CssClass="LinkButton" OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')" OnClick="Delete_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Delete.gif" />&nbsp;&nbsp;ลบข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="AddNewSave" runat="server" CssClass="LinkButton" Visible="false" onclick="AddNewSave_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="EditSave" runat="server" CssClass="LinkButton" Visible="false" onclick="EditSave_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                                </asp:LinkButton>
                                            </td>
                                            <td class="command-item">
                                                <asp:LinkButton ID="Cancel" runat="server" CssClass="LinkButton" Visible="false" onclick="Cancel_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                                </asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div> 
            
                        </asp:Panel>
                        <telerik:RadToolTip runat="server" ID="RadToolTip2" Width="650px" Height="70px" 
                            TargetControlID="AddNew" ShowEvent="OnClick"
                            IsClientID="false" Animation="Fade" 
                            Position="BottomRight" Skin="Default" Modal="true" ManualClose="true">
                            <table width="100%">
                                <tr>
                                    <td>
                                        <table width="98%" class="font-label">
                                            <tr>
                                                <td width="100px">
                                                    ประเภทการรับเข้า : 
                                                </td>
                                                <td>
                                                    <telerik:RadComboBox runat="server" ID="cmbReceiveType" Height="230px" Width="200px" 
                                                    AllowCustomText="true" 
                                                    ShowDropDownOnTextboxClick="true"
                                                    EmptyMessage=".. พิมพ์ที่นี่เพื่อช่วยค้นหา .." MarkFirstMatch="false" 
                                                    ShowMoreResultsBox="true" 
                                                    EnableLoadOnDemand="true" 
                                                    EnableVirtualScrolling="true" 
                                                    HighlightTemplatedItems="true" 
                                                    OnItemsRequested="cmbReceiveType_ItemsRequested"
                                                    OnClientTextChange="onTextChangeGeneral" ZIndex="8001">
                                                    <HeaderTemplate>
                                                        <table class="font-label" cellpadding="0" cellspacing="0">
                                                            <tr>
                                                                <td width="200px" align="center"><b>ประเภทการรับเข้า</b></td>
                           
                                                            </tr>
                                                        </table>
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:Table id="tableReceiveType" runat="server" CssClass="font-label" CellPadding="0" CellSpacing="0">
                                                        </asp:Table>
                                                    </ItemTemplate>
                                                </telerik:RadComboBox>
                                                &nbsp;
                                                <label id="Label3" runat="server"><font color="red">*</font></label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                </td>
                                                <td>
                                                    <asp:RequiredFieldValidator ID="ValcbSeller" runat="server" 
                                                        ControlToValidate="cmbReceiveType" 
                                                        SetFocusOnError="True" Display="Dynamic" 
                                                        ErrorMessage="* กรุณาระบุประเภทการรับเข้า *" ValidationGroup="Seller">
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2" align="center">
                                                    <br />
                                                    <asp:LinkButton ID="btnAddNew" runat="server" 
                                                        Text="สร้างรายการ" CssClass="form-button" 
                                                        OnClick="btnAddNew_Click" ValidationGroup="Seller">
                                                    </asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </telerik:RadToolTip>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Panel ID="panelData" runat="server">
                            <div class="bigModulePaneFull">
                                <div class="bigModuleBottomPaneFull">
                                    <asp:Panel ID="panelHeaderList" runat="server">
                                        <div class="header-grid">
                                            <asp:Label ID="lblHeaderList" runat="server" Text="รายการรับพัสดุเข้าคลัง"></asp:Label>                                            &nbsp;
                                            
                                            <asp:Label runat="server" ID="lblReceiveSeq" Visible = "false"></asp:Label>
                                        </div>
                                    </asp:Panel>
                                    <asp:Panel CssClass="panelList" runat="server" ID="panelList" ScrollBars="Auto">
                                        <ul class="formList" id="Ul1">  
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            เรื่อง :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblName" AssociatedControlID="txtName" ></asp:Label>
                                                            <asp:TextBox CssClass="TextBox" ID="txtName" runat="server" Visible="false" Width="300px"></asp:TextBox>
                                                            <label id="Label1" runat="server"><font color="red">*</font></label>
                                                            <asp:LinkButton ID="btnShowReceiveItem" runat="server" CssClass="LinkButton" Visible = "false" 
                                                                onclick="btnShowReceiveItem_Click"> (รายการพัสดุ)
                                                            </asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="ValtxtName" runat="server" ControlToValidate="txtName" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุชื่อหน่วยนับ *"></asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div> 
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            ประเภทการรับเข้า :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblReceiveType" AssociatedControlID="cbReceiveType"></asp:Label>
                                                            <telerik:RadComboBox 
                                                                ID="cbReceiveType" 
                                                                runat="server" 
                                                                AllowCustomText="true" 
                                                                AutoPostBack="true" 
                                                                CausesValidation="false" 
                                                                DataTextField="Name" 
                                                                DataValueField="Sequence" 
                                                                EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                                                Filter="Contains" 
                                                                OnClientTextChange="onTextChangeGeneral"                                                                 
                                                                Width="200px">
                                                            </telerik:RadComboBox>
                                                            <label id="Label4" runat="server"><font color="red">*</font></label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="ValcbReceiveType" runat="server" ControlToValidate="cbReceiveType" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุประเภทการรับเข้า *"></asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div> 
                                        <telerik:RadAjaxPanel ID="RadAjaxPanel3" runat="server">        
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            อ้างอิงใบตรวจรับหมายเลข :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblDN" AssociatedControlID="cmbDN"></asp:Label>
                                                            <telerik:RadComboBox ID="cmbDN" runat="server" 
                                                                AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                                                EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                OnClientTextChange="onTextChangeGeneral" 
                                                                OnItemsRequested="cmbDN_ItemsRequested"                                                                         
                                                                ShowDropDownOnTextboxClick="true" 
                                                                ShowMoreResultsBox="true" 
                                                                Width="450px">
                                                                <HeaderTemplate>
                                                                    <table cellpadding="0" cellspacing="0" class="font-label">
                                                                        <tr>
                                                                            <td align="left" width="100px"><b>เลขที่ใบตรวจรับ</b></td>
                                                                            <td align="left" width="250px"><b>เรื่องตรวจรับ</b></td>      
                                                                            <td align="left" width="100px"><b>วันที่อนุมัติการตรวจรับ</b></td>                                 
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Table ID="tableDN" runat="server" CellPadding="0" 
                                                                        CellSpacing="0" CssClass="font-label">
                                                                    </asp:Table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="ValcmbDN" runat="server" 
                                                                ControlToValidate="cmbDN" 
                                                                SetFocusOnError="True" Display="Dynamic" 
                                                                ErrorMessage="* กรุณาระบุเลขที่ใบตรวจรับ *">
                                                            </asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div> 
                                        </telerik:RadAjaxPanel>
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            ประเภทพัสดุ :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblInventoryType" AssociatedControlID="cmbInventoryType"></asp:Label>
                                                            <telerik:RadComboBox ID="cmbInventoryType" runat="server" 
                                                                AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                                                EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                OnClientTextChange="onTextChangeGeneral" 
                                                                OnItemsRequested="cmbInventoryType_ItemsRequested"                                                                         
                                                                ShowDropDownOnTextboxClick="true" 
                                                                ShowMoreResultsBox="true" 
                                                                Width="250px">
                                                                <HeaderTemplate>
                                                                    <table cellpadding="0" cellspacing="0" class="font-label">
                                                                        <tr>
                                                                            <td align="left" width="250px"><b>ชื่อประเภทพัสดุ</b></td>                            
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Table ID="tableInventoryType" runat="server" CellPadding="0" 
                                                                        CellSpacing="0" CssClass="font-label">
                                                                    </asp:Table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                            <label id="Label5" runat="server"><font color="red">*</font></label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="ValcmbInventoryType" runat="server" ControlToValidate="cmbInventoryType" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุประเภทพัสดุ *"></asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>        
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                           วันที่หนังสือรับเข้า :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblIcmReceiveDate" AssociatedControlID="txtIcmReceiveDate"></asp:Label>
                                                            <telerik:RadMaskedTextBox ID="txtIcmReceiveDate" runat="server" Mask="##/##/####" Width="75px" TextWithLiterals=" //" SelectionOnFocus="SelectAll"></telerik:RadMaskedTextBox>
                                                            <asp:LinkButton ID="LinkButton3" runat="server" CssClass="LinkButton">
                                                                <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                            </asp:LinkButton>
                                                            <telerik:RadToolTip ID="ToolTipIcmReceiveDate" runat="server" 
                                                                Animation="None" HideEvent="LeaveToolTip" 
                                                                Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                                TargetControlID="LinkButton3" Modal="true">
                                                                <telerik:RadCalendar id="CalendarIcmReceiveDate" runat="server" 
                                                                    TitleFormat="MMMM yyyy" 
                                                                    EnableMultiSelect="false" 
                                                                    UseRowHeadersAsSelectors="false" 
                                                                    UseColumnHeadersAsSelectors="false" 
                                                                    DayCellToolTipFormat="dddd, dd MMMM, yyyy" 
                                                                    NavigationPrevToolTip="เดือนก่อนหน้า" 
                                                                    NavigationNextToolTip="เดือนถัดไป" 
                                                                    FastNavigationNextToolTip="3 เดือนถัดไป" 
                                                                    FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                    <ClientEvents OnDateClick="OnReceiveDateClick" 
                                                                        OnCalendarViewChanged="OnCalendarViewChanged">
                                                                    </ClientEvents>
                                                                    <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                                </telerik:RadCalendar>
                                                            </telerik:RadToolTip>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            สถานที่รับเข้า :
                                                        </td>
                                                        <td width = "150px">   
                                                            <asp:RadioButtonList ID="rblPlaceType" runat="server" 
                                                                CausesValidation="false"                                                                                                                             
                                                                RepeatDirection="Horizontal" RepeatLayout="Flow">
                                                                <asp:ListItem Selected="True" Text="รับเข้าคลัง" Value="1"></asp:ListItem>
                                                                <asp:ListItem Text="สำนัก/กอง" Value="0"></asp:ListItem>
                                                            </asp:RadioButtonList>
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblWareHouse" AssociatedControlID="cmbWareHouse"></asp:Label>
                                                            <asp:Label runat="server" ID="lblToJobSite" AssociatedControlID="cmbToJobSite"></asp:Label> 
                                                            <telerik:RadComboBox ID="cmbWareHouse" runat="server" 
                                                                AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                                                EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                OnClientTextChange="onTextChangeGeneral" 
                                                                OnItemsRequested="cmbWareHouse_ItemsRequested"                                                                         
                                                                ShowDropDownOnTextboxClick="true" 
                                                                ShowMoreResultsBox="true" 
                                                                Width="150px">
                                                                <HeaderTemplate>
                                                                    <table cellpadding="0" cellspacing="0" class="font-label">
                                                                        <tr>
                                                                            <td align="center" width="150px"><b>ชื่อคลังพัสดุ</b></td>
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Table ID="tableWareHouse" runat="server" CellPadding="0" 
                                                                        CellSpacing="0" CssClass="font-label">
                                                                    </asp:Table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                            <telerik:RadComboBox ID="cmbToJobSite" runat="server" 
                                                                AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                                                EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                OnClientTextChange="onTextChangeGeneral" 
                                                                OnItemsRequested="cmbToJobSite_ItemsRequested"                                                                         
                                                                ShowDropDownOnTextboxClick="true" 
                                                                ShowMoreResultsBox="true"                  
                                                                Width="250px">
                                                                <HeaderTemplate>
                                                                    <table cellpadding="0" cellspacing="0" class="font-label">
                                                                        <tr>
                                                                            <td align="center" width="250px"><b>ชื่อสำนัก/กอง</b></td>
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <asp:Table ID="tableToJobSite" runat="server" CellPadding="0" 
                                                                        CellSpacing="0" CssClass="font-label">
                                                                    </asp:Table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                            <label id="Label6" runat="server"><font color="red">*</font></label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:Panel ID="panelValJobSite" runat="server"></asp:Panel>                                                            
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>                                            
                                        <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server">
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            สถานที่ต้นทาง :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblFromTransfer" AssociatedControlID="txtFromTransfer"></asp:Label>
                                                            <asp:TextBox CssClass="TextBox" ID="txtFromTransfer" runat="server" Width="300px"></asp:TextBox>
                                                            <label id="Label7" runat="server"><font color="red">*</font></label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="reqFromTransfer" runat="server" ControlToValidate="txtFromTransfer" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุชื่อสถานที่ต้นทาง *"></asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px">
                                                            เลขที่หนังอ้างอิงจากต้นทาง :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblTranRefNo" AssociatedControlID="txtTranRefNo"></asp:Label>
                                                            <asp:TextBox CssClass="TextBox" ID="txtTranRefNo" runat="server" Width="300px"></asp:TextBox>
                                                            <label id="Label8" runat="server"><font color="red">*</font></label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="reqTranRefNo" runat="server" ControlToValidate="txtTranRefNo" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุชื่อสถานที่ต้นทาง *"></asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </telerik:RadAjaxPanel>
                                            <div class="formList-detail">
                                                <table>
                                                    <tr>
                                                        <td width = "150px" valign="top">
                                                            หมายเหตุเพิ่มเติม :
                                                        </td>
                                                        <td>
                                                            <asp:Label runat="server" ID="lblRemark" AssociatedControlID="txtRemark"></asp:Label>
                                                            <asp:TextBox CssClass="TextBox" ID="txtRemark" runat="server" TextMode="MultiLine" Height="50" Width="500px" ></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </ul>
                                    </asp:Panel>
                                    <asp:Panel CssClass="panelGrid" ID="panelGrid" runat="server" ScrollBars="Auto" Visible="true">
                                        <div align="center">
                                            <telerik:RadGrid ID="grdInventory" 
                                            runat="server" 
                                            AutoGenerateColumns="false"
                                            AllowMultiRowEdit="false" 
                                            AllowMultiRowSelection="true" 
                                            ShowStatusBar="true"
                                            Width="930px" Height="330px" 
                                            AllowPaging="true" 
                                            AllowFilteringByColumn="true"                                 
                                            GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                                            GroupingSettings-GroupContinuedFormatString=""
                                            GroupingSettings-GroupContinuesFormatString=""
                                            GroupingSettings-GroupSplitFormat="" PageSize ="7" 
                                            OnItemCommand="grdInventory_ItemCommand" align ="left">
                                            <MasterTableView AllowMultiColumnSorting="True" 
                                                CellSpacing="-1" GroupLoadMode="Client"
                                                ShowGroupFooter="true" 
                                                DataKeyNames="icm_receive_seq" 
                                                ClientDataKeyNames = "icm_receive_seq"
                                                NoMasterRecordsText="< ไม่มีข้อมูล >" 
                                                GroupsDefaultExpanded="true">
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px" />
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px" />
                                                </ExpandCollapseColumn>
                                                <Columns>   
                                                <telerik:GridTemplateColumn AllowFiltering="false" 
                                                    UniqueName="Delete" HeaderText="ลบ" 
                                                    HeaderStyle-Width="35px" 
                                                    HeaderStyle-Font-Bold="false" 
                                                    HeaderStyle-HorizontalAlign="Center"> 
                                                    <FilterTemplate></FilterTemplate>
                                                    <ItemTemplate>
                                                         <asp:ImageButton ID="cmdDelete" runat="server" 
                                                            CommandName="DataDelete"
                                                            ImageUrl="~/App_UI/Image/Grid/Delete.gif" 
                                                            OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')"
                                                            ToolTip="ลบรายการ" width="17" /> 
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                               <telerik:GridTemplateColumn DataField="icm_receive_code"  
                                                    HeaderText="รหัสอ้างอิงการรับเข้า"
                                                    AutoPostBackOnFilter="true" 
                                                    AllowFiltering = "true"
                                                    CurrentFilterFunction="Contains" 
                                                    ShowFilterIcon="false"
                                                    FilterControlWidth="100%" 
                                                    UniqueName="icm_receive_code" 
                                                    SortExpression="icm_receive_code">
                                                    <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                                    <ItemStyle HorizontalAlign="Left" />
                                                    <ItemTemplate>
                                                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#" onclick='<%# Eval("icm_receive_seq","return SeqClick( {0} );") %>' Text='<%# Eval("icm_receive_code") %>'></asp:HyperLink>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                
                                                <telerik:GridBoundColumn DataField="icm_receive_name" 
                                                    HeaderText="เรื่อง" UniqueName="icm_receive_name"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" 
                                                    ShowFilterIcon="false" 
                                                    HeaderStyle-Width="130px"
                                                    HeaderStyle-Font-Bold="false" 
                                                    HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>      
                                                <telerik:GridBoundColumn DataField="icm_wh_name" 
                                                    HeaderText="คลังพัสดุ" UniqueName="icm_wh_name"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" 
                                                    ShowFilterIcon="false" 
                                                    HeaderStyle-Width="130px"
                                                    HeaderStyle-Font-Bold="false" 
                                                    HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="job_site_name" 
                                                    HeaderText="หน่วยงาน" UniqueName="job_site_name"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" 
                                                    ShowFilterIcon="false" 
                                                    HeaderStyle-Width="130px"
                                                    HeaderStyle-Font-Bold="false" 
                                                    HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="icm_res_type_name" 
                                                    HeaderText="ประเภทพัสดุ" 
                                                    UniqueName="icm_res_type_name"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="70px" 
                                                    HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="receive_type_name" 
                                                    HeaderText="ประเภทการรับเข้า" UniqueName="receive_type_name"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px"
                                                    HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="created_when" Visible = "false"
                                                    HeaderText="วันที่ทำรายการ" UniqueName="created_when"
                                                    DataFormatString = "{0:dd/MM/yyyy}"
                                                    FilterControlWidth="100%" 
                                                    AllowFiltering = "true"
                                                    AutoPostBackOnFilter="true"
                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px"
                                                    HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>
<%--                                                <telerik:GridBoundColumn DataField="status_name" 
                                                    HeaderText="สถานะ" UniqueName="status_name"
                                                    FilterControlWidth="100%" AutoPostBackOnFilter="true"HeaderStyle-Width="77px"
                                                    CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                                    HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center">
                                                </telerik:GridBoundColumn>--%>

                                            </Columns>
                                            <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                                                FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                                NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                                PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                            </MasterTableView>
                                            <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                                                GroupContinuedFormatString="" GroupContinuesFormatString="" 
                                                GroupSplitFormat="" />
                                            <ClientSettings EnableRowHoverStyle="True">
                                                <Selecting AllowRowSelect="true" />
                                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                            </ClientSettings>
                                      </telerik:RadGrid>
                                        </div>
                                        <br />
                                    </asp:Panel>
                                </div>
                            </div>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </telerik:RadPane>
    </telerik:RadSplitter>
</asp:Content>

